"""
应用配置
"""

from pathlib import Path
from typing import List, Optional
import os

class Settings:
    """应用设置"""
    
    # 基础路径
    BASE_DIR: Path = Path(__file__).parent.parent.parent
    
    # 服务配置
    HOST: str = os.getenv("HOST", "0.0.0.0")
    PORT: int = int(os.getenv("PORT", "8000"))
    DEBUG: bool = os.getenv("DEBUG", "false").lower() == "true"
    
    # CORS 配置
    ALLOWED_HOSTS: Optional[List[str]] = os.getenv("ALLOWED_HOSTS", "").split(",") if os.getenv("ALLOWED_HOSTS") else None
    
    # 目录配置
    UPLOAD_DIR: Path = BASE_DIR / "uploads"
    OUTPUT_DIR: Path = BASE_DIR / "output" 
    LOGS_DIR: Path = BASE_DIR / "logs"
    MODELS_DIR: Path = BASE_DIR / "models"
    
    # 文件配置
    MAX_FILE_SIZE: int = 1024 * 1024 * 1024  # 1GB
    ALLOWED_EXTENSIONS: List[str] = [".wav", ".mp3", ".m4a", ".flac", ".aac"]
    
    # 处理配置
    DEFAULT_CHUNK_SIZE: int = 900  # 秒
    LARGE_FILE_THRESHOLD: int = 50 * 1024 * 1024  # 50MB
    
    # 模型配置
    ASR_MODEL: str = "paraformer-zh"
    VAD_MODEL: str = "fsmn-vad"
    PUNC_MODEL: str = "ct-punc"
    SPK_MODEL: str = "cam++"
    
    # 任务配置
    MAX_CONCURRENT_TASKS: int = int(os.getenv("MAX_CONCURRENT_TASKS", "3"))
    TASK_TIMEOUT: int = int(os.getenv("TASK_TIMEOUT", "3600"))  # 1小时
    
    # 日志配置
    LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
    LOG_ROTATION: str = "1 day"
    LOG_RETENTION: str = "30 days"
    
    # AI 模型配置
    DEEPSEEK_API_KEY: str = os.getenv("DEEPSEEK_API_KEY", "ms-266fc02f-62f7-4aaf-8dc9-5507ef206eb0")
    DEEPSEEK_BASE_URL: str = os.getenv("DEEPSEEK_BASE_URL", "https://api-inference.modelscope.cn/v1/")
    DEEPSEEK_MODEL: str = os.getenv("DEEPSEEK_MODEL", "deepseek-ai/DeepSeek-R1-0528")

# 创建设置实例
settings = Settings()